<template>
  <j-modal
    :title="title"
    :visible="visible"
    :maskClosable="false"
    :ok-button-props="{ props: { disabled: disableSubmit } }"
    :fullscreen="true"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <div style="margin: 0 auto" :class="{ isCheck: isCheck }">
      <table class="table table-striped table-bordered" align="center" valign="center">
        <tr>
          <td class="column title" colspan="8">基本信息</td>
        </tr>
        <tr>
          <td class="column" colspan="1">审计机构名称</td>
          <td class="value" colspan="3">
            <a-input v-model="queryParam.departName" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column" colspan="1">审计人员数量</td>
          <td class="value" colspan="3">
            <a-input v-model="queryParam.sjrysl" :disabled="disableSubmit"></a-input>
          </td>
        </tr>
        <tr>
          <td class="column">上级机构</td>
          <td class="value">
            <a-input v-model="queryParam.parentName" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column">机构名称</td>
          <td class="value">
            <a-input v-model="queryParam.departName" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column">单位详细名称</td>
          <td class="value">
            <a-input v-model="queryParam.detailName" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column">统一社会信用代码或原组织机构代码</td>
          <td class="value">
            <a-input v-model="queryParam.cerdit" :disabled="disableSubmit"></a-input>
          </td>
        </tr>
        <tr>
          <td class="column">机构类型</td>
          <td class="value">
            <a-input v-model="queryParam.orgType_dictText" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column">是否审计机构</td>
          <td class="value">
            <a-input v-model="queryParam.isOrg_dictText" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column">主要业务活动</td>
          <td class="value">
            <a-input v-model="queryParam.yyhd_dictText" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column">行业代码</td>
          <td class="value">
            <a-input v-model="queryParam.hydm_dictText" :disabled="disableSubmit"></a-input>
          </td>
        </tr>
        <tr>
          <td class="column">省（自治区、直辖市）</td>
          <td class="value">
            <a-input v-model="queryParam.province_dictText" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column">地（区、市、州、盟）</td>
          <td class="value">
            <a-input v-model="queryParam.city_dictText" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column">县（区、市、旗）</td>
          <td class="value">
            <a-input v-model="queryParam.county_dictText" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column">乡（镇）</td>
          <td class="value">
            <a-input v-model="queryParam.town_dictText" :disabled="disableSubmit"></a-input>
          </td>
        </tr>
        <tr>
          <td class="column">街（村）</td>
          <td class="value">
            <a-input v-model="queryParam.village_dictText" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column">门牌号</td>
          <td class="value">
            <a-input v-model="queryParam.houseNumber" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column">区划代码</td>
          <td class="value">
            <a-input v-model="queryParam.qydm" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column">城乡代码</td>
          <td class="value">
            <a-input v-model="queryParam.cxdm" :disabled="disableSubmit"></a-input>
          </td>
        </tr>
        <tr>
          <td class="column">单位规模</td>
          <td class="value">
            <a-input v-model="queryParam.dwgm_dictText" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column">从业人员期末人数（个）</td>
          <td class="value">
            <a-input v-model="queryParam.cyrs" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column">法定代表人（单位主要负责人）</td>
          <td class="value">
            <a-input v-model="queryParam.leader" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column">执行会计准则类别</td>
          <td class="value">
            <a-input v-model="queryParam.kjzelb_dictText" :disabled="disableSubmit"></a-input>
          </td>
        </tr>
        <tr>
          <td class="column">长途区号</td>
          <td class="value">
            <a-input v-model="queryParam.ctqh" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column">固定电话</td>
          <td class="value">
            <a-input v-model="queryParam.gddh" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column">邮政编码</td>
          <td class="value">
            <a-input v-model="queryParam.zipCode" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column">电子邮箱</td>
          <td class="value">
            <a-input v-model="queryParam.email" :disabled="disableSubmit"></a-input>
          </td>
        </tr>
        <tr>
          <td class="column">邮箱网址</td>
          <td class="value">
            <a-input v-model="queryParam.emailAddr" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column">本法人单位是否有上一级法人</td>
          <td class="value">
            <a-input v-model="queryParam.dlsjjg_dictText" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column">上一级法人单位统一社会信用代码（或原组织结构代码）</td>
          <td class="value">
            <a-input v-model="queryParam.sjcredit" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column">上一级法人单位详细名称</td>
          <td class="value">
            <a-input v-model="queryParam.sjfr" :disabled="disableSubmit"></a-input>
          </td>
        </tr>
        <tr>
          <td class="column">总审计设置情况</td>
          <td class="value">
            <a-input v-model="queryParam.zsjqk_dictText" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column">总审计师职位层级（领导班子等）</td>
          <td class="value">
            <a-input v-model="queryParam.zsjzw_dictText" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column">总审计师任职方式（上一级法人单位委派等）</td>
          <td class="value">
            <a-input v-model="queryParam.zsjrz_dictText" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column">内部审计机构设置</td>
          <td class="value">
            <a-input v-model="queryParam.nbsjsz_dictText" :disabled="disableSubmit"></a-input>
          </td>
        </tr>
        <tr>
          <td class="column">具体名称</td>
          <td class="value">
            <a-input v-model="queryParam.jtmc" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column">内部审计工作领导机构</td>
          <td class="value">
            <a-input v-model="queryParam.nbsjld_dictText" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column">独立审计机构设置</td>
          <td class="value">
            <a-input v-model="queryParam.dlsjjg_dictText" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column">合并设置职能部门</td>
          <td class="value">
            <a-input v-model="queryParam.hbznbm_dictText" :disabled="disableSubmit"></a-input>
          </td>
        </tr>
        <tr>
          <td class="column" colspan="1">内部审计机构层级</td>
          <td class="value" colspan="1">
            <a-input v-model="queryParam.nbsjcj" :disabled="disableSubmit"></a-input>
          </td>
          <td class="column" colspan="1">备注</td>
          <td class="value" colspan="5">
            <a-input v-model="queryParam.memo" :disabled="disableSubmit"></a-input>
          </td>
        </tr>
        <tr>
          <td class="column title" colspan="8">内部人员信息</td>
        </tr>
        <tr>
          <td class="value" style="padding: 0" colspan="8">
            <a-table
              bordered
              :columns="columns1"
              style="width: calc(100vw - 48px)"
              :dataSource="dataSource1"
              :pagination="ipagination1"
              :scroll="{ x: 200, y: 240 }"
            >
              <template slot="honor" slot-scope="honor">
                <div style="width: 100%; height: 45px; overflow-x: hidden; overflow-y: auto">{{ honor }}</div>
              </template>
              <template slot="honorOther" slot-scope="honorOther">
                <div style="width: 100%; height: 45px; overflow-x: hidden; overflow-y: auto">{{ honorOther }}</div>
              </template>
              <template slot="compileSystem" slot-scope="compileSystem">
                <div style="width: 100%; height: 45px; overflow-x: hidden; overflow-y: auto">{{ compileSystem }}</div>
              </template>
              <template slot="compileSystemOther" slot-scope="compileSystemOther">
                <div style="width: 100%; height: 45px; overflow-x: hidden; overflow-y: auto">
                  {{ compileSystemOther }}
                </div>
              </template>
              <template slot="paper" slot-scope="paper">
                <div style="width: 100%; height: 45px; overflow-x: hidden; overflow-y: auto">{{ paper }}</div>
              </template>
              <template slot="paperOther" slot-scope="paperOther">
                <div style="width: 100%; height: 45px; overflow-x: hidden; overflow-y: auto">{{ paperOther }}</div>
              </template>
            </a-table>
          </td>
        </tr>
        <tr>
          <td class="column title" colspan="8">外部人员信息</td>
        </tr>
        <tr>
          <td class="value" colspan="8" style="padding: 0">
            <a-table
              ref="table"
              bordered
              style="width: calc(100vw - 48px)"
              :columns="columns2"
              :dataSource="dataSource2"
              :pagination="ipagination2"
              :scroll="{ x: 200, y: 240 }"
            >
              <template slot="honor" slot-scope="honor">
                <div style="width: 100%; height: 45px; overflow-x: hidden; overflow-y: auto">{{ honor }}</div>
              </template>
              <template slot="honorOther" slot-scope="honorOther">
                <div style="width: 100%; height: 45px; overflow-x: hidden; overflow-y: auto">{{ honorOther }}</div>
              </template>
              <template slot="compileSystem" slot-scope="compileSystem">
                <div style="width: 100%; height: 45px; overflow-x: hidden; overflow-y: auto">{{ compileSystem }}</div>
              </template>
              <template slot="compileSystemOther" slot-scope="compileSystemOther">
                <div style="width: 100%; height: 45px; overflow-x: hidden; overflow-y: auto">
                  {{ compileSystemOther }}
                </div>
              </template>
              <template slot="paper" slot-scope="paper">
                <div style="width: 100%; height: 45px; overflow-x: hidden; overflow-y: auto">{{ paper }}</div>
              </template>
              <template slot="paperOther" slot-scope="paperOther">
                <div style="width: 100%; height: 45px; overflow-x: hidden; overflow-y: auto">{{ paperOther }}</div>
              </template>
            </a-table>
          </td>
        </tr>
        <tr>
          <td class="column title" colspan="8">审计专家信息</td>
        </tr>
        <tr>
          <td class="value" colspan="8" style="padding: 0">
            <a-table
              ref="table"
              class="edit-list"
              bordered
              style="width: calc(100vw - 48px)"
              :columns="columns3"
              :dataSource="dataSource3"
              :pagination="ipagination3"
              :scroll="{ x: 200, y: 240 }"
            >
            </a-table>
          </td>
        </tr>
      </table>
    </div>
  </j-modal>
</template>
<script>
import { httpAction, getAction } from '@/api/manage'
import columns1 from './columns1'
import columns2 from './columns2'
import columns3 from './columns3'

export default {
  name: 'SysPositionModal',
  components: {},
  data() {
    return {
      ipagination1: {
        current: 1,
        pageSize: 10,
        showTotal: (total, range) => {
          return range[0] + '-' + range[1] + ' 共' + total + '条'
        },
        onChange: (pageNumber) => {
          this.onChange1(pageNumber)
        },
        showQuickJumper: true,
        total: 0,
      },
      ipagination2: {
        current: 1,
        pageSize: 10,
        showTotal: (total, range) => {
          return range[0] + '-' + range[1] + ' 共' + total + '条'
        },
        onChange: (pageNumber) => {
          this.onChange2(pageNumber)
        },
        showQuickJumper: true,
        total: 0,
      },
      ipagination3: {
        current: 1,
        pageSize: 10,
        showTotal: (total, range) => {
          return range[0] + '-' + range[1] + ' 共' + total + '条'
        },
        onChange: (pageNumber) => {
          this.onChange3(pageNumber)
        },
        showQuickJumper: true,
        total: 0,
      },
      disableSubmit: false,
      title: '机构信息',
      visible: false,
      isCheck: false,
      model: {},
      columns1: columns1(this),
      columns2: columns2(this),
      columns3: columns3(this),
      dataSource1: [],
      dataSource2: [],
      dataSource3: [],
      queryParam: {
        orgCodeTxt: '',
      },
      url: {
        get: '/sys/sysDepart/queryDeptDetailByDeptId',
        list1: '/sjzyzhgl/sjResourceAuditors/interiorAuditPersonList',
        list2: '/sjzyzhgl/sjResourceAuditors/outsideAuditPersonList',
        list3: '/sjzyzhgl/sjResourceExpert/expertAuditPersonList',
      },
    }
  },
  created() {},
  methods: {
    check(record) {
      this.model = Object.assign({}, record)
      this.visible = true
      this.info()
      this.list1()
      this.list2()
      this.list3()
    },
    info() {
      getAction(this.url.get, { id: this.model.id }).then((res) => {
        if (res.success && res.result) {
          this.queryParam = res.result.records[0]
        } else {
          console.log(res)
        }
      })
    },
    list1() {
      getAction(this.url.list1, {
        id: this.model.id,
        pageSize: this.ipagination1.pageSize,
        pageNo: this.ipagination1.current,
      }).then((res) => {
        if (res.success && res.result) {
          this.dataSource1 = res.result.records
          this.ipagination1.total = res.result.total
        } else {
          this.ipagination1.total = 0
        }
      })
    },
    onChange1(pageNumber) {
      this.ipagination1.current = pageNumber
      this.list1()
    },
    list2() {
      getAction(this.url.list2, {
        id: this.model.id,
        pageSize: this.ipagination2.pageSize,
        pageNo: this.ipagination2.current,
      }).then((res) => {
        if (res.success && res.result) {
          this.dataSource2 = res.result.records
          this.ipagination2.total = res.result.total
        } else {
          this.ipagination2.total = 0
        }
      })
    },
    onChange2(pageNumber) {
      this.ipagination2.current = pageNumber
      this.list2()
    },
    list3() {
      getAction(this.url.list3, {
        id: this.model.id,
        pageSize: this.ipagination3.pageSize,
        pageNo: this.ipagination3.current,
      }).then((res) => {
        if (res.success && res.result) {
          this.dataSource3 = res.result.records
          this.ipagination3.total = res.result.total
        } else {
          this.ipagination3.total = 0
        }
      })
    },
    onChange3(pageNumber) {
      this.ipagination3.current = pageNumber
      this.list3()
    },
    close() {
      this.visible = false
    },
    handleCancel() {
      this.close()
    },
  },
}
</script>

<style lang="less" scoped>
@import '../../css/checkAndEdit.less';
</style>
